<template>
	<view class="col">
		<view class="row">
			<image src="/static/images/search.svg" class="close"></image>
			<u-input border="bottom" placeholder="输入搜索内容" class="search-text" :fontSize="20"> </u-input>
			<image src="/static/images/close.svg" class="close"></image>
		</view>
		    <u-tabs :list="list1" @click="click"></u-tabs>

		
		
	</view>
</template>

<script>
	import {searchTop,addFlow} from '@/api/change/index.js'
	export default {
		data() {
			return {
				list1:[
					{
						name:'作品'
					},
					{
						name:'章节'
					},
				],
				name:'',
				list:[],
				keyword:'',
				pageType:''
				// 1飙升榜，2：人气榜，3：打赏榜，4：畅销版，5：新书版
			}
		},
		onLoad(option) {
			this.name = option.name
			if(option.type == 'quick'){
				this.keyword = option.name
				this.getKeyword()
			}else{
				this.getTop()
			}
		},
		methods: {
			goback(){
				uni.navigateBack()
			},
			getTop(){
				if(this.name == '飙升榜'){
					this.pageType =1
				}else if(this.name == '人气榜'){
					this.pageType =2
				}else if(this.name == '打赏榜'){
					this.pageType =3
				}else if(this.name == '畅销版'){
					this.pageType =4
				}else if(this.name == '新书版'){
					this.pageType =5
				}
				searchTop({pageType:this.pageType}).then(res=>{
					this.list =res.data
				})
			},
		addFollow(item) {
			addFlow({workId:item.id}).then(res => {
				if(!item.isFlow){
					item.isFlow=1
				}else{
					item.isFlow=0
				}
			})
		},
			getKeyword(){
				searchKeyword({keyword:this.keyword,page:this.page,pageSize:this.pageSize}).then(res=>{
					
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.close{
		width: 60rpx;
		height: 60rpx;
	}
	.search-text{
		width: 500rpx;
		font-size: 60rpx;
	}
</style>
